<?php namespace Home\Controller;
use Hdphp\Controller\Controller;
class ZhuceController extends Controller{      
    private $userModel;
	public function __init(){
		$this->userModel = new \Common\Model\HomeUser;
	}
 	  
	public function index(){
		if(IS_POST){
			//jieshou
			$username=Q('post.username');
			$password=Q('post.password');
//			通过接受model里面的login方法返回的值（true/false）来判定是否登录成功
//			if(!$this->userModel->zhuce()) View::error($this->userModel->getError());
//			注册成功，跳转到主页
           $model= new \Common\Model\HomeUser;
         $model->add(array('username'=>$username,'password'=>md5($password)));
			View::success('注册成功',U('Login/index'));
		}
		View::make();
	}
}
